<?php  $this->_extends('_layouts/admin/main_layout'); ?>

<?php $this->_block('resource'); ?>

<?php $this->_endblock(); ?>

<?php $this->_block('title'); ?>
	Html Templates
<?php $this->_endblock(); ?>

<?php $this->_block('contents'); ?>

<div id="content" class="box">
	<h1>模板类别</h1>
	
	<ul class="formErrors">
		<?php $formErrors = $typeModel->getValidateError(); if(!empty($formErrors)): ?>
			<?php foreach($formErrors as $item => $errors): ?>
				<li>
					<?php echo $item; ?>
					<ul>
						<?php foreach($errors as $error): ?>
							<li class="error"><?php echo $error; ?></li>
						<?php endforeach; ?>
					</ul>
				</li>
			<?php endforeach; ?>
		<?php endif; ?>
	</ul>
	
	<fieldset>
		<legend id="area">区域分类</legend>
		<form action="<?php echo url('admintypes/htmltemplate', array('ope' => 'add')); ?>" method="post">
			<input type="hidden" name="whichType" value="area" />
			<span>地区(Zh)：</span>
			<input name="name" />&nbsp;&nbsp;
			<span>地区(En)：</span>
			<input name="name_en" />&nbsp;&nbsp;
			<input type="submit" value="添加" />
		</form>
		<table class="full-size" style="text-align: center;">
			<thead>
				<tr>
					<th>地区(Zh)</th>
					<th>地区(En)</th>
					<th>默认值</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<?php if(!empty($htmltemplateTypes['type_area'])): foreach($htmltemplateTypes['type_area'] as $ht_t): ?>
					<tr>
						<td><?php echo $ht_t['name']; ?></td>
						<td><?php echo $ht_t['name_en']; ?></td>
						<td><?php echo ($ht_t['is_default'] == 1)? '是' : ''; ?></td>
						<td>
							<a href="<?php echo url('admintypes/htmltemplate', array('ope' => 'delete', 'id' => $ht_t['id'], 'whichType' => 'area')); ?>">删除</a>
							<a href="<?php echo url('admintypes/htmltemplate', array('ope' => 'setdefault', 'id' => $ht_t['id'], 'whichType' => 'area')); ?>">设为默认</a>
						</td>
					</tr>
				<?php endforeach; endif; ?>
			</tbody>
		</table>
	</fieldset>
	
	<fieldset>
		<legend id="color">色彩分类</legend>
		<form action="<?php echo url('admintypes/htmltemplate', array('ope' => 'add')); ?>" method="post">
			<input type="hidden" name="whichType" value="color" />
			<span>颜色名称(Zh)：</span>
			<input name="name" />&nbsp;&nbsp;
			<span>颜色名称(En)：</span>
			<input name="name_en" />&nbsp;&nbsp;
			<span>颜色Hex值：</span>
			<input size="10" name="color_hex" />&nbsp;&nbsp;
			<input type="submit" value="添加" />
		</form>
		<table class="full-size" style="text-align: center;">
			<thead>
				<tr>
					<th>颜色名称(Zh)</th>
					<th>颜色名称(En)</th>
					<th>Hex值</th>
					<th>默认值</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<?php if(!empty($htmltemplateTypes['type_color'])): foreach($htmltemplateTypes['type_color'] as $ht_t): ?>
					<tr>
						<td><?php echo $ht_t['name']; ?></td>
						<td><?php echo $ht_t['name_en']; ?></td>
						<td>
							<span style="text-decoration: underline; color: <?php echo $ht_t['color_hex']; ?>;"><?php echo $ht_t['color_hex']; ?></span>
						</td>
						<td><?php echo ($ht_t['is_default'] == 1)? '是' : ''; ?></td>
						<td>
							<a href="<?php echo url('admintypes/htmltemplate', array('ope' => 'delete', 'id' => $ht_t['id'], 'whichType' => 'color')); ?>">删除</a>
							<a href="<?php echo url('admintypes/htmltemplate', array('ope' => 'setdefault', 'id' => $ht_t['id'], 'whichType' => 'color')); ?>">设为默认</a>
						</td>
					</tr>
				<?php endforeach; endif; ?>
			</tbody>
		</table>
	</fieldset>
	
	<fieldset>
		<legend id="columnwidth">行列分类</legend>
		<form action="<?php echo url('admintypes/htmltemplate', array('ope' => 'add')); ?>" method="post">
			<input type="hidden" name="whichType" value="columnwidth" />
			<span>名称(Zh)：</span>
			<input name="name" />&nbsp;&nbsp;
			<span>名称(En)：</span>
			<input name="name_en" />&nbsp;&nbsp;
			<input type="submit" value="添加" />
		</form>
		<table class="full-size" style="text-align: center;">
			<thead>
				<tr>
					<th>名称(Zh)</th>
					<th>名称(En)</th>
					<th>默认值</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<?php if(!empty($htmltemplateTypes['type_columnwidth'])): foreach($htmltemplateTypes['type_columnwidth'] as $ht_t): ?>
					<tr>
						<td><?php echo $ht_t['name']; ?></td>
						<td><?php echo $ht_t['name_en']; ?></td>
						<td><?php echo ($ht_t['is_default'] == 1)? '是' : ''; ?></td>
						<td>
							<a href="<?php echo url('admintypes/htmltemplate', array('ope' => 'delete', 'id' => $ht_t['id'], 'whichType' => 'columnwidth')); ?>">删除</a>
							<a href="<?php echo url('admintypes/htmltemplate', array('ope' => 'setdefault', 'id' => $ht_t['id'], 'whichType' => 'columnwidth')); ?>">设为默认</a>
						</td>
					</tr>
				<?php endforeach; endif; ?>
			</tbody>
		</table>
	</fieldset>
	
	<fieldset>
		<legend id="sidebarcorner">侧边栏分类</legend>
		<form action="<?php echo url('admintypes/htmltemplate', array('ope' => 'add')); ?>" method="post">
			<input type="hidden" name="whichType" value="sidebarcorner" />
			<span>名称(Zh)：</span>
			<input name="name" />&nbsp;&nbsp;
			<span>名称(En)：</span>
			<input name="name_en" />&nbsp;&nbsp;
			<input type="submit" value="添加" />
		</form>
		<table class="full-size" style="text-align: center;">
			<thead>
				<tr>
					<th>名称(Zh)</th>
					<th>名称(En)</th>
					<th>默认值</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<?php if(!empty($htmltemplateTypes['type_sidebarcorner'])): foreach($htmltemplateTypes['type_sidebarcorner'] as $ht_t): ?>
					<tr>
						<td><?php echo $ht_t['name']; ?></td>
						<td><?php echo $ht_t['name_en']; ?></td>
						<td><?php echo ($ht_t['is_default'] == 1)? '是' : ''; ?></td>
						<td>
							<a href="<?php echo url('admintypes/htmltemplate', array('ope' => 'delete', 'id' => $ht_t['id'], 'whichType' => 'sidebarcorner')); ?>">删除</a>
							<a href="<?php echo url('admintypes/htmltemplate', array('ope' => 'setdefault', 'id' => $ht_t['id'], 'whichType' => 'sidebarcorner')); ?>">设为默认</a>
						</td>
					</tr>
				<?php endforeach; endif; ?>
			</tbody>
		</table>
	</fieldset>
	
	<fieldset>
		<legend id="using">用途分类</legend>
		<form action="<?php echo url('admintypes/htmltemplate', array('ope' => 'add')); ?>" method="post">
			<input type="hidden" name="whichType" value="using" />
			<span>名称(Zh)：</span>
			<input name="name" />&nbsp;&nbsp;
			<span>名称(En)：</span>
			<input name="name_en" />&nbsp;&nbsp;
			<input type="submit" value="添加" />
		</form>
		<table class="full-size" style="text-align: center;">
			<thead>
				<tr>
					<th>名称(Zh)</th>
					<th>名称(En)</th>
					<th>默认值</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<?php if(!empty($htmltemplateTypes['type_using'])): foreach($htmltemplateTypes['type_using'] as $ht_t): ?>
					<tr>
						<td><?php echo $ht_t['name']; ?></td>
						<td><?php echo $ht_t['name_en']; ?></td>
						<td><?php echo ($ht_t['is_default'] == 1)? '是' : ''; ?></td>
						<td>
							<a href="<?php echo url('admintypes/htmltemplate', array('ope' => 'delete', 'id' => $ht_t['id'], 'whichType' => 'using')); ?>">删除</a>
							<a href="<?php echo url('admintypes/htmltemplate', array('ope' => 'setdefault', 'id' => $ht_t['id'], 'whichType' => 'using')); ?>">设为默认</a>
						</td>
					</tr>
				<?php endforeach; endif; ?>
			</tbody>
		</table>
	</fieldset>
</div>

<script>
	window.location.hash = '<?php echo $whichType; ?>';
</script>
<?php $this->_endblock(); ?>